<script>
	export default {
		globalData: {
			system: [],
			menu: [],
			statusBarHeight: 0, //状态栏的高度
			navigatorHeight: 0, //导航栏高度
			menuHeight: 0, //胶囊高度
			menuTop: 0, //胶囊与顶部的距离
			totalHeight: 0, //总高度

			// 屏幕总高度
			screenHeight: 0,
			// 滚动高度  减去导航栏高度
			scrollViewHeight: 0,

			// 可滚动高度  减去 导航栏高度 和 底部tabbar 高度
			scrollViewHeight2: 0,

			// 工厂/门店ID
			storeId: '',
			// 租户id
			tenantId: '',

			// 用户信息

			userInfo: {},


			devId: '1',



			platform: "",
			screenWidth: uni.getSystemInfoSync().screenWidth,
			screenHeight: uni.getSystemInfoSync().screenHeight,

			BLEInformation: { 
				platform: "",
				deviceId: "",
				writeCharaterId: "",
				writeServiceId: "",
				notifyCharaterId: "",
				notifyServiceId: "",
				readCharaterId: "",
				readServiceId: "",
			}
		},





		methods: {
			getModel: function() { //获取手机型号
				return this.globalData.sysinfo["model"]
			},
			getVersion: function() { //获取微信版本号
				return this.globalData.sysinfo["version"]
			},
			getSystem: function() { //获取操作系统版本
				return this.globalData.sysinfo["system"]
			},
			getPlatform: function() { //获取客户端平台
				return this.globalData.sysinfo["platform"]
			},
			getSDKVersion: function() { //获取客户端基础库版本
				return this.globalData.sysinfo["SDKVersion"]
			},
		},

		onLaunch: function() {
			this.globalData.sysinfo = uni.getSystemInfoSync()
			console.log('App Launch')
			// 保存Storeid
			// uni.setStorageSync('storeId',1)
			// 保存租户id
			// uni.setStorageSync('tenantId',1)


			this.globalData.storeId = uni.getStorageSync('storeId')
			this.globalData.tenantId = uni.getStorageSync('tenantId')
			this.globalData.userInfo = uni.getStorageSync('userInfo')


			//获取系统信息
			uni.getSystemInfo({
				success: res => {
					this.globalData.system = res
					this.globalData.screenHeight = res.windowHeight
					// console.log('屏幕信息',this.globalData.screenHeight, res);
				}
			})

			//获取胶囊信息
			this.globalData.menu = uni.getMenuButtonBoundingClientRect()

			//计算组件高度
			this.globalData.statusBarHeight = this.globalData.system.statusBarHeight //状态栏高度
			this.globalData.menuHeight = this.globalData.menu.height //胶囊高度
			this.globalData.menuTop = this.globalData.menu.top //胶囊与顶部的距离
			//导航栏高度= （胶囊顶部距离-状态栏高度） x 2 + 胶囊的高度
			this.globalData.navigatorHeight = (this.globalData.menu.top - this.globalData.system.statusBarHeight) * 2 +
				this.globalData.menu.height
			//总高度 = 状态栏的高度 + 导航栏高度
			this.globalData.totalHeight = this.globalData.statusBarHeight + this.globalData.navigatorHeight


			this.globalData.scrollViewHeight = this.globalData.screenHeight - this.globalData.totalHeight
			// console.log('状态栏高度',this.globalData.totalHeight,this.globalData.scrollViewHeight);
			this.globalData.scrollViewHeight2 = this.globalData.system.screenHeight - this.globalData.totalHeight

		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		},

	}
</script>

<style>
	/*每个页面公共css */

	uni-page-body,
	html,
	body {
		height: 100%;
	}

	.Global {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		width: 750rpx;




	}
</style>